﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using RFS.BizLogic.PaiShi.Ports;
using RFS.BizLogic.Sys.impl;
using RFS.Domain.PaiShi.Zuhuo;
using ycx;

namespace ItProto1
{
    public class ItZahua
    {
        [Test]
        public void T1_zahua()
        {
            var en = AntiObject.Ins.Get<IRepoZahua>();
            var rzu = AntiObject.Ins.Get<IRepoZuhuaPort>();
            var zm = AntiObject.Ins.Get<IRepoZuhuaPort>();
            var re = en.GetRecordsByDay(DateTime.Today.AddDays(-1));


            re.Count().Echo();
            re = re.Where(x => x.GroupKey == "DK44_014_50_45673");
            var gs = rzu.BuildGroupZuhuo(re.ToList());
    
            // gs to zuhuo ziling
           // var rs= CreateZuhuos(gs);
           var rs = rzu.CreateZuhuoPlans(gs.ToList(), ZuHuoType.首次组花, true  );


           // rzu.GetFahuomaFor(rs.succ);
           
           rs.succ.Count().Echo("s");
           rs.failed.Count().Echo("f");
           
           rs.succ.FirstOrDefault().Echo("s");
           rs.failed .FirstOrDefault().Echo("f");

           // var fjson = "t1.json";
           
           

        }


     


        [Test]
        public void t2_zuhua()
        {
            var en = AntiObject.Ins.Get<IRepoZuhuaPort>();
            // var re=en.GetRecordsByDay(DateTime.Today.AddDays(0));

            var re = en.ProdTypeItems;

            re.Count().Echo();
            re.First().Echo();
        }
        
      
 
 
    
 
        
        
        
    }
}